#!/bin/bash
if [[ $# -ge 2 ]]; then
    account=$1
    passwd=$2
else
    echo "Account:"
    read account
    echo "Password:"
    read -s passwd
fi
pid=2
server="http://10.10.43.3/"
calg=`curl -s "${server}md5calg"|grep calg|sed 's/{"calg":"//'|sed 's/"}//'`
ec=`printf ${pid}${passwd}${calg} | md5sum | awk '{print $1}'`
upass=${ec}${calg}${pid}
curl -s "${server}"  --data "DDDDD=${account}&upass=${upass}&R1=0&R2=1&para=00&hid1=&hid2=&0MKKey=123456">/dev/null
status=`curl -s "${server}" | grep "time='"`
echo ${status//[^0-9]/\ }|awk '{printf "Flow: %.2f MB; Time: %d Min; Balance: RMB %.2f.\n",$2/1024,$1,$4/10000}'
